home *** CD-ROM | disk | FTP | other *** search
- property flashSymbol, flashMember, flashSound, flashTime, flashDelay, flashList, nonFlashMember, sprt
- global FlashMgr, SndMgr
-
- on getPropertyDescriptionList
- d = [:]
- lst = []
- if the number of member "flashField" <> -1 then
- tmpList = value(the text of field "flashField")
- else
- tmpList = []
- end if
- repeat with i = 1 to count(tmpList)
- add(lst, getPropAt(tmpList, i))
- end repeat
- addProp(d, #flashSymbol, [#default: EMPTY, #format: #symbol, #range: lst, #comment: "Flash symbol"])
- addProp(d, #flashMember, [#default: EMPTY, #format: #string, #comment: "Flash member"])
- addProp(d, #flashSound, [#default: EMPTY, #format: #string, #comment: "Flash sound"])
- addProp(d, #flashDelay, [#default: 10, #format: #integer, #comment: "Flash delay (in ticks)"])
- return d
- end
-
- on beginSprite me
- sprt = sprite(me.spriteNum)
- flashList = value(the text of field "flashField")[flashSymbol]
- nonFlashMember = sprt.member
- FlashMgr.register(sprt, flashSymbol, flashDelay, flashList)
- end
-
- on endSprite me
- FlashMgr.unregister(sprt, flashSymbol)
- end
-
- on flash me
- if flashMember = EMPTY then
- if sprt.visible then
- sprt.visible = 0
- else
- sprt.visible = 1
- playFlashSound()
- end if
- else
- if sprt.member = nonFlashMember then
- sprt.member = flashMember
- playFlashSound()
- else
- sprt.member = nonFlashMember
- end if
- end if
- end
-
- on playFlashSound me
- if flashSound <> EMPTY then
- sym = symbol(#flash & flashSymbol)
- SndMgr.killSfxId(sym)
- SndMgr.sfx(flashSound, VOID, sym)
- end if
- end
-
- on killFlash me
- if flashMember = EMPTY then
- sprt.visible = 1
- else
- sprt.member = nonFlashMember
- end if
- sym = symbol(#flash & flashSymbol)
- SndMgr.killSfxId(sym)
- end
-